package com.dd;

import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;

import com.chantel.tool.db.DBUtil;
import com.dd.exception.UserNotFoundException;

public class BuMenInfo {
	private int id;
	private String buMenMingCheng;
	private int quanXian;
	//
	//审核部门的名称
	//
	public String getBuMenMingCheng() {
		return buMenMingCheng;
	}
	public void setBuMenMingCheng(String buMenMingCheng) {
		this.buMenMingCheng = buMenMingCheng;
	}
	//
	//ID
	//
	public int getId() {
		return id;
	}
	public void setId(int id) {
		this.id = id;
	}
	//
	//审核部门的权限,值大,权限大.
	public int getQuanXian() {
		return quanXian;
	}
	public void setQuanXian(int quanXian) {
		this.quanXian = quanXian;
	}
	
	//
	//返回所有的审核部门
	//
	public static ArrayList GetAllBuMens()
	{
		DBUtil du = DBUtil.getInstance();
		
		ArrayList aL = new ArrayList();
		String sql = "select* from BuMenInfoTable";
		List l = du.getRecords(sql);
		
		Iterator it =  l.iterator();
		while(it.hasNext())
		{
			Map m = (Map)it.next();
			
			int id = ((Integer) m.get("BuMenId")).intValue();			
			String mingCheng = (String)m.get("BuMenMing");	
			int nQuanXian = ((Integer)m.get("QuanXian")).intValue();	
		
			BuMenInfo bm = new BuMenInfo();
			bm.setBuMenMingCheng(mingCheng);
			bm.setId(id);
			bm.setQuanXian(nQuanXian);
			aL.add(bm);	
		}		
		return aL;
	}
	
	public static void main(String[] args)
	{
		
		ArrayList al = BuMenInfo.GetAllBuMens();
		
		Iterator it = al.iterator();
		while(it.hasNext())
		{
			BuMenInfo bm = (BuMenInfo)it.next();
			System.out.print(bm.getId());
			System.out.println(bm.getBuMenMingCheng());
		}
		
		
	}
}